package day04;

import java.util.Random;
import java.util.Scanner;

import static java.lang.Math.random;
import java.util.Scanner;
public class Guessing {
    public static void main(String[] args) {
        Scanner scan =new Scanner(System.in);
        System.out.println("请输入猜数的值：");
        int numm =(int)(random()*1000);
        int guess=scan.nextInt();
        while(guess!=numm){
            if(guess>numm){
                System.out.println("猜错了！猜数大了哦");
            }
            else{
                System.out.println("猜错了！猜数小了哦");
            }
            System.out.println("请重新输入猜数的值：");
            guess=scan.nextInt();}
        System.out.println("great!猜对了哦，你真棒！！！！");


        Scanner scan1 =new Scanner(System.in);
        System.out.println("请输入猜数的值：");
        Random random=new Random();
        int num =random.nextInt(1000)+1;
        int gues=scan1.nextInt();
        while(gues!=num){
            if(gues>num){
                System.out.println("猜错了！猜数大了哦");
            }
            else{
                System.out.println("猜错了！猜数小了哦");
            }
            System.out.println("请重新输入猜数的值：");
            gues=scan1.nextInt();}
        System.out.println("great!猜对了哦，你真棒！！！！");
    }
    }


